@extends('layouts.console_header')

@section('title', '翻倍日详情')

@section('resources')
    @parent
    <!-- css 文件 -->

@endsection

@section('content')
<!--  html内容  -->
<section class="user_list">
	<div style="border-bottom: 2px solid #9955c6;overflow: hidden;">
		<p class="fz_14 account_title fl" style="border: none;">
		    <span style="color: #7f7f7f;">
		        <a href="/console/index">首页</a>>商家版运营>
		        <a href="/console/shop/doubleday/choose?cityid={{$cityid}}">翻倍日管理</a>>
            </span>
            <span class="co_violet">翻倍日{{$event}}详情</span>
        </p>
        <a href="/console/shop/doubleday/export?cityid={{$cityid}}&event={{$event}}"><p class="fr tc back_btn">导出</p></a>
		<a onclick="history.go(-1);" href="#"><p class="fr tc back_btn">返回</p></a>
	</div>
	<table id="example" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>序号</th>
                <th>一级分类</th>
                <th>二级分类</th>
                <th>商家代码</th>
                <th>门店名称</th>
                <th>开拓人</th>
                <th>维护人</th>
                <th>商家级别</th>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <th>序号</th>
                <th>一级分类</th>
                <th>二级分类</th>
                <th>商家代码</th>
                <th>门店名称</th>
                <th>开拓人</th>
                <th>维护人</th>
                <th>商家级别</th>
            </tr>
        </tfoot>
        <tbody>
            @foreach($lists as $list)
            <tr>
                @if(!isset($i))
                    <td>{{$i=1}}</td>
                @else
                    <td>{{++$i}}</td>
                @endif
                <td>{{$list['firstclassname']}}</td>
                <td>{{$list['secondclassname']}}</td>
                <td>{{$list['shopcode']}}</td>
                <td>{{$list['shopname']}}</td>
                <td>{{$list['oldmaintainer']}}</td>
                <td>{{$list['realname']}}</td>
                <td>{{$list['grade']}}</td>
                {{--<td>{{$list['contactnumber']}}</td>--}}
                {{--@if($list['todayevent'] == '1')--}}
                {{--<td>参与</td>--}}
                {{--<td>--}}
                {{--@if($todaytime <= $strtotimeevent)--}}
                {{--<a class="co_violet" href="#" onclick="cancel_double({{$list['shopid']}})">取消今日翻倍</a>--}}
                {{--@endif--}}
                {{--</td>--}}
                {{--@else--}}
                {{--<td>不参与</td>--}}
                {{--<td>--}}
                {{--@if($todaytime <= $strtotimeevent)--}}
                {{--<a class="co_violet" href="#" onclick="open_double({{$list['shopid']}})">开通今日翻倍</a>--}}
                {{--@endif--}}
                {{--</td>--}}
                {{--@endif--}}
            </tr>
            @endforeach
        </tbody>
    </table>
</section>
@endsection

@section('scriptResources')
    @parent
    <script>
        var cityid = '{{$cityid}}';
        function cancel_double(shopid) {
            $('.hot_search_mark').show();
            $('.public_prompt_mark').show();
            $('.public_prompt_mark').height($(window).height());
            $('.doublebtn_title').html('取消翻倍日');
            $('.doublebtn_content').html('确定要取消翻倍日?');
            $('.hot_search_mark .sure').click(function(){
                $.ajax({
                    url : '/console/shop/event/today/update',
                    type : 'post',
                    data: {
                        'shopid':shopid,
                        'cityid':cityid,
                        'type': '0'
                    },
                    dataType:'json',
                    success:function(data){
                        if(data.status == 'success') {
                            location.reload();
                        } else {
                            alert(data.message);
                        }
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        alert(XMLHttpRequest.status);
                        alert(XMLHttpRequest.readyState);
                        alert(textStatus);
                    }
                });
            });
            $('.hot_search_mark .cancel').click(function(){
                $('.hot_search_mark').hide();
                $('.public_prompt_mark').hide();
            });
            $('.hot_search_mark .close').click(function(){
                $('.hot_search_mark').hide();
                $('.public_prompt_mark').hide();
            });
        }
        function open_double(shopid) {
            $('.hot_search_mark').show();
            $('.public_prompt_mark').show();
            $('.public_prompt_mark').height($(window).height());
            $('.doublebtn_title').html('开通翻倍日');
            $('.doublebtn_content').html('确定要开通翻倍日?');
            $('.hot_search_mark .sure').click(function(){
                $.ajax({
                    url : '/console/shop/event/today/update',
                    type : 'post',
                    data: {
                        'shopid':shopid,
                        'cityid':cityid,
                        'type': '1'
                    },
                    dataType:'json',
                    success:function(data){
                        if(data.status == 'success') {
                            location.reload();
                        } else {
                            alert(data.message);
                        }
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        alert(XMLHttpRequest.status);
                        alert(XMLHttpRequest.readyState);
                        alert(textStatus);
                    }
                });
            });
            $('.hot_search_mark .cancel').click(function(){
                $('.hot_search_mark').hide();
                $('.public_prompt_mark').hide();
            });
            $('.hot_search_mark .close').click(function(){
                $('.hot_search_mark').hide();
                $('.public_prompt_mark').hide();
            })
        }
    </script>

@endsection